var http  = require('http');
var fs = require('fs');
var server = http.createServer();

server.on('request',function(request,response){
    //解决跨域问题
    //*表示所有地址都可以访问
    response.setHeader('Access-Control-Allow-Origin','*');

    response.writeHead(200,{'Content-Type':'text/plain;charset=utf-8'})
    var data = fs.readFileSync('./data/news.json');
    response.end(data);
   
})
server.listen(3010,function(err){
    console.log('服务器创建成功! http://localhost:3010');
})